<?php

namespace app\admin\controller;

use app\admin\model\Logs as ModelLogs;
use app\BaseController;
use think\facade\Session;

class Logs extends Base
{
    public function index()
    {
        $this->logs('[管理员]日志视图');
        return view();
    }
    public function list()
    {
        $this->logs('[管理员]日志列表');
        $limit = input('limit') == '' ? 20 : input('limit');
        $list = ModelLogs::order('id desc')->paginate($limit);
        $data = [
            "code" => 0,
            'msg' => '',
            'count' => $list->total(),
            'data' => $list
        ];
        return json($data);
    }
    public function del($id)
    {
        $this->logs('[管理员]日志删除');
        $res = ModelLogs::whereIn('id',$id)->delete();
        if ($res) return success();
        else return error();
    }
}
